<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body bgcolor="white">
        <p>A matches method is defined by this class as a convenience for when a 
            regular expression is used just once. This method compiles an expression
            and matches an input sequence against it in a single invocation.
            The statement</p>
        <blockquote>
            <pre>
 "a*b" = "aaaaab"
            </pre>
        </blockquote>
        is equivalent to the three statements above, though for repeated matches
        it is less efficient since it does not allow the compiled pattern to be
        reused.

        <p>Instances of this class are immutable and are safe for use by multiple
            concurrent threads. Instances of the Matcher class are not safe for
            such use.</p>

        <h4>Summary of regular-expression constructs</h4>
        <table border="0" cellpadding="1" cellspacing="0" summary="Regular expression constructs, and what they match">
            <tbody>
                <tr align="left">
                    <th bgcolor="#CCCCFF" align="left" id="construct">Construct</th>
                    <th bgcolor="#CCCCFF" align="left" id="matches">Matches</th>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="characters">Characters</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <i>x</i>
                    </td>
                    <td headers="matches">The character
                        <i>x</i></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\\</tt>
                    </td>
                    <td headers="matches">The backslash character</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\0</tt>
                        <i>n</i>
                    </td>
                    <td headers="matches">The character with octal value
                        <tt>0</tt>
                        <i>n</i>(0&#160;
                        <tt>&lt;=</tt>&#160;
                        <i>n</i>&#160;
                        <tt>&lt;=</tt>&#160;7)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\0</tt>
                        <i>nn</i>
                    </td>
                    <td headers="matches">The character with octal value
                        <tt>0</tt>
                        <i>nn</i>(0&#160;
                        <tt>&lt;=</tt>&#160;
                        <i>n</i>&#160;
                        <tt>&lt;=</tt>&#160;7)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\0</tt>
                        <i>mnn</i>
                    </td>
                    <td headers="matches">The character with octal value
                        <tt>0</tt>
                        <i>mnn</i>(0&#160;
                        <tt>&lt;=</tt>&#160;
                        <i>m</i>&#160;
                        <tt>&lt;=</tt>&#160;3, 0&#160;
                        <tt>&lt;=</tt>&#160;
                        <i>n</i>&#160;
                        <tt>&lt;=</tt>&#160;7)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\x</tt>
                        <i>hh</i>
                    </td>
                    <td headers="matches">The character with hexadecimal&#160;value&#160;
                        <tt>0x</tt>
                        <i>hh</i></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\u</tt>
                        <i>hhhh</i>
                    </td>
                    <td headers="matches">The character with hexadecimal&#160;value&#160;
                        <tt>0x</tt>
                        <i>hhhh</i></td>
                </tr>
                <tr>
                    <td valign="top" headers="matches">
                        <tt>\t</tt>
                    </td>
                    <td headers="matches">The tab character (
                        <tt>'\u0009'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\n</tt>
                    </td>
                    <td headers="matches">The newline (line feed) character (
                        <tt>'\u000A'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\r</tt>
                    </td>
                    <td headers="matches">The carriage-return character (
                        <tt>'\u000D'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\f</tt>
                    </td>
                    <td headers="matches">The form-feed character (
                        <tt>'\u000C'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\a</tt>
                    </td>
                    <td headers="matches">The alert (bell) character (
                        <tt>'\u0007'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\e</tt>
                    </td>
                    <td headers="matches">The escape character (
                        <tt>'\u001B'</tt>)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct characters">
                        <tt>\c</tt>
                        <i>x</i>
                    </td>
                    <td headers="matches">The control character corresponding to
                        <i>x</i></td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="classes">Character classes</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[abc]</tt>
                    </td>
                    <td headers="matches">
                        <tt>a</tt>,
                        <tt>b</tt>, or
                        <tt>c</tt>(simple class)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[^abc]</tt>
                    </td>
                    <td headers="matches">Any character except
                        <tt>a</tt>,
                        <tt>b</tt>, or
                        <tt>c</tt>(negation)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[a-zA-Z]</tt>
                    </td>
                    <td headers="matches">
                        <tt>a</tt>through
                        <tt>z</tt>or
                        <tt>A</tt>through
                        <tt>Z</tt>, inclusive (range)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[a-d[m-p]]</tt>
                    </td>
                    <td headers="matches">
                        <tt>a</tt>through
                        <tt>d</tt>, or
                        <tt>m</tt>through
                        <tt>p</tt>:
                        <tt>[a-dm-p]</tt>(union)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[a-z&amp;&amp;[def]]</tt>
                    </td>
                    <td headers="matches">
                        <tt>d</tt>,
                        <tt>e</tt>, or
                        <tt>f</tt>(intersection)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[a-z&amp;&amp;[^bc]]</tt>
                    </td>
                    <td headers="matches">
                        <tt>a</tt>through
                        <tt>z</tt>, except for
                        <tt>b</tt>and
                        <tt>c</tt>:
                        <tt>[ad-z]</tt>(subtraction)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct classes">
                        <tt>[a-z&amp;&amp;[^m-p]]</tt>
                    </td>
                    <td headers="matches">
                        <tt>a</tt>through
                        <tt>z</tt>, and not
                        <tt>m</tt>through
                        <tt>p</tt>:
                        <tt>[a-lq-z]</tt>(subtraction)</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="predef">Predefined character classes</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>.</tt>
                    </td>
                    <td headers="matches">Any character (may or may not match line terminators)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\d</tt>
                    </td>
                    <td headers="matches">A digit:
                        <tt>[0-9]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\D</tt>
                    </td>
                    <td headers="matches">A non-digit:
                        <tt>[^0-9]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\s</tt>
                    </td>
                    <td headers="matches">A whitespace character:
                        <tt>[ \t\n\x0B\f\r]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\S</tt>
                    </td>
                    <td headers="matches">A non-whitespace character:
                        <tt>[^\s]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\w</tt>
                    </td>
                    <td headers="matches">A word character:
                        <tt>[a-zA-Z_0-9]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct predef">
                        <tt>\W</tt>
                    </td>
                    <td headers="matches">A non-word character:
                        <tt>[^\w]</tt></td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="posix">POSIX character classes (US-ASCII only)
                        <b></b></th>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Lower}</tt>
                    </td>
                    <td headers="matches">A lower-case alphabetic character:
                        <tt>[a-z]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Upper}</tt>
                    </td>
                    <td headers="matches">An upper-case alphabetic character:
                        <tt>[A-Z]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{ASCII}</tt>
                    </td>
                    <td headers="matches">All ASCII:
                        <tt>[\x00-\x7F]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Alpha}</tt>
                    </td>
                    <td headers="matches">An alphabetic character:
                        <tt>[\p{Lower}\p{Upper}]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Digit}</tt>
                    </td>
                    <td headers="matches">A decimal digit:
                        <tt>[0-9]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Alnum}</tt>
                    </td>
                    <td headers="matches">An alphanumeric character:
                        <tt>[\p{Alpha}\p{Digit}]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Punct}</tt>
                    </td>
                    <td headers="matches">Punctuation: One of
                        <tt>!"#$%&amp;'()*+,-./:;&lt;=&gt;?@[\]^_`{|}~</tt></td>
                </tr>
                <!-- <tt>[\!"#\$%&'\(\)\*\+,\-\./:;\<=\>\?@\[\\\]\^_`\{\|\}~]</tt>
                  <tt>[\X21-\X2F\X31-\X40\X5B-\X60\X7B-\X7E]</tt> -->
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Graph}</tt>
                    </td>
                    <td headers="matches">A visible character:
                        <tt>[\p{Alnum}\p{Punct}]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Print}</tt>
                    </td>
                    <td headers="matches">A printable character:
                        <tt>[\p{Graph}]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Blank}</tt>
                    </td>
                    <td headers="matches">A space or a tab:
                        <tt>[ \t]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Cntrl}</tt>
                    </td>
                    <td headers="matches">A control character:
                        <tt>[\x00-\x1F\x7F]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{XDigit}</tt>
                    </td>
                    <td headers="matches">A hexadecimal digit:
                        <tt>[0-9a-fA-F]</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct posix">
                        <tt>\p{Space}</tt>
                    </td>
                    <td headers="matches">A whitespace character:
                        <tt>[ \t\n\x0B\f\r]</tt></td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="unicode">Classes for Unicode blocks and categories</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct unicode">
                        <tt>\p{InGreek}</tt>
                    </td>
                    <td headers="matches">
                        A character in the Greek&#160;block (simple block)
                    </td>
                </tr>
                <tr>
                    <td valign="top" headers="construct unicode">
                        <tt>\p{Lu}</tt>
                    </td>
                    <td headers="matches">
                        An uppercase letter (simple category)
                    </td>
                </tr>
                <tr>
                    <td valign="top" headers="construct unicode">
                        <tt>\p{Sc}</tt>
                    </td>
                    <td headers="matches">A currency symbol</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct unicode">
                        <tt>\P{InGreek}</tt>
                    </td>
                    <td headers="matches">Any character except one in the Greek block (negation)</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct unicode">
                        <tt>[\p{L}&amp;&amp;[^\p{Lu}]]&#160;</tt>
                    </td>
                    <td headers="matches">Any letter except an uppercase letter (subtraction)</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="bounds">Boundary matchers</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>^</tt>
                    </td>
                    <td headers="matches">The beginning of a line</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>$</tt>
                    </td>
                    <td headers="matches">The end of a line</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\b</tt>
                    </td>
                    <td headers="matches">A word boundary</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\B</tt>
                    </td>
                    <td headers="matches">A non-word boundary</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\A</tt>
                    </td>
                    <td headers="matches">The beginning of the input</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\G</tt>
                    </td>
                    <td headers="matches">The end of the previous match</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\Z</tt>
                    </td>
                    <td headers="matches">
                        The end of the input but for the final terminator, if&#160;any
                    </td>
                </tr>
                <tr>
                    <td valign="top" headers="construct bounds">
                        <tt>\z</tt>
                    </td>
                    <td headers="matches">The end of the input</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="greedy">Greedy quantifiers</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, once or not at all</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>*</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, zero or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, one or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>}</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, exactly
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,}</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct greedy">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,</tt>
                        <i>m</i>
                        <tt>}</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>but not more than
                        <i>m</i>times</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="reluc">Reluctant quantifiers</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>??</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, once or not at all</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>*?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, zero or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>+?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, one or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>}?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, exactly
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,}?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct reluc">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,</tt>
                        <i>m</i>
                        <tt>}?</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>but not more than
                        <i>m</i>times</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="poss">Possessive quantifiers</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>?+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, once or not at all</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>*+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, zero or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>++</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, one or more times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>}+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, exactly
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,}+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>times</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct poss">
                        <i>X</i>
                        <tt>{</tt>
                        <i>n</i>
                        <tt>,</tt>
                        <i>m</i>
                        <tt>}+</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, at least
                        <i>n</i>but not more than
                        <i>m</i>times</td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="logical">Logical operators</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct logical">
                        <i>XY</i>
                    </td>
                    <td headers="matches">
                        <i>X</i>followed by
                        <i>Y</i></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct logical">
                        <i>X</i>
                        <tt>|</tt>
                        <i>Y</i>
                    </td>
                    <td headers="matches">Either
                        <i>X</i>or
                        <i>Y</i></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct logical">
                        <tt>(</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        X, as a capturing group
                    </td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="backref">Back references</th>
                </tr>
                <tr>
                    <td valign="bottom" headers="construct backref">
                        <tt>\</tt>
                        <i>n</i>
                    </td>
                    <td valign="bottom" headers="matches">
                        Whatever the <i>n</i> <sup>th</sup>capturing group matched
                    </td>
                </tr>
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="quot">Quotation</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct quot">
                        <tt>\</tt>
                    </td>
                    <td headers="matches">Nothing, but quotes the following character</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct quot">
                        <tt>\Q</tt>
                    </td>
                    <td headers="matches">Nothing, but quotes all characters until
                        <tt>\E</tt></td>
                </tr>
                <tr>
                    <td valign="top" headers="construct quot">
                        <tt>\E</tt>
                    </td>
                    <td headers="matches">Nothing, but ends quoting started by
                        <tt>\Q</tt></td>
                </tr>
                <!-- Metachars: !$()*+.<>?[\]^{|} -->
                <tr>
                    <th>&#160;</th>
                </tr>
                <tr align="left">
                    <th colspan="2" id="special">Special constructs (non-capturing)</th>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?:</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, as a non-capturing group</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?idmsux-idmsux)&#160;</tt>
                    </td>
                    <td headers="matches">Nothing, but turns match flags on - off</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?idmsux-idmsux:</tt>
                        <i>X</i>
                        <tt>)</tt>&#160;&#160;
                    </td>
                    <td headers="matches">
                        <i>X</i>, as a non-capturing group with the given flags on - off
                    </td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?=</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, via zero-width positive lookahead</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?!</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, via zero-width negative lookahead</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?&lt;=</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, via zero-width positive lookbehind</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?&lt;!</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, via zero-width negative lookbehind</td>
                </tr>
                <tr>
                    <td valign="top" headers="construct special">
                        <tt>(?&gt;</tt>
                        <i>X</i>
                        <tt>)</tt>
                    </td>
                    <td headers="matches">
                        <i>X</i>, as an independent, non-capturing group</td>
                </tr>
            </tbody>
        </table>
        <h4>Backslashes, escapes, and quoting</h4>
        <p>The backslash character (
            <tt>'\'</tt>) serves to introduce escaped constructs, as defined in the table above, as well as to quote characters that otherwise would be interpreted as unescaped constructs. Thus the expression
            <tt>\\</tt>matches a single backslash and
            <tt>\{</tt>matches a left brace.</p>
        <p>It is an error to use a backslash prior to any alphabetic character that does not denote an escaped construct; these are reserved for future extensions to the regular-expression language. A backslash may be used prior to a non-alphabetic character
            regardless of whether that character is part of an unescaped construct.</p>
        <p>
            <a name="bs">Backslashes within string literals in Java source code are interpreted as required by the</a>
            Java Language Specification as either
            Unicode escapes or other
            character escapes. It is therefore necessary to double backslashes in string literals that represent regular expressions to protect them from interpretation by
            the Java bytecode compiler. The string literal
            <tt>"\b"</tt>, for example, matches a single backspace character when interpreted as a regular expression, while
            <tt>"\\b"</tt>matches a word boundary. The string literal
            <tt>"\(hello\)"</tt>is illegal and leads to a compile-time error; in order to match the string
            <tt>(hello)</tt>the string literal
            <tt>"\\(hello\\)"</tt>must be used.
        </p>
        <h4>
            <a name="cc">Character Classes</a>
        </h4>
        <p>Character classes may appear within other character classes, and may be composed by the union operator (implicit) and the intersection operator (
            <tt>&amp;&amp;</tt>). The union operator denotes a class that contains every character that is in at least one of its operand classes. The intersection operator denotes a class that contains every character that is in both of its operand classes.</p>
        <p>The precedence of character-class operators is as follows, from highest to lowest:</p>
        <blockquote>
            <table border="0" cellpadding="1" cellspacing="0" summary="Precedence of character class operators.">
                <tbody>
                    <tr>
                        <th>1&#160;&#160;&#160;&#160;</th>
                        <td>Literal escape&#160;&#160;&#160;&#160;</td>
                        <td>
                            <tt>\x</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>2&#160;&#160;&#160;&#160;</th>
                        <td>Grouping</td>
                        <td>
                            <tt>[...]</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>3&#160;&#160;&#160;&#160;</th>
                        <td>Range</td>
                        <td>
                            <tt>a-z</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>4&#160;&#160;&#160;&#160;</th>
                        <td>Union</td>
                        <td>
                            <tt>[a-e][i-u]
                                <tt></tt></tt>
                        </td>
                    </tr>
                    <tr>
                        <th>5&#160;&#160;&#160;&#160;</th>
                        <td>Intersection</td>
                        <td>
                            <tt>[a-z&amp;&amp;[aeiou]]</tt>
                        </td>
                    </tr>
                </tbody>
            </table>
        </blockquote>
        <p>
            <a name="cc">Note that a different set of metacharacters are in effect inside a character class than outside a character class. For instance, the regular expression
                <tt>.</tt>loses its special meaning inside a character class, while the expression
                <tt>-</tt>becomes a range forming metacharacter.</a>
            <a name="lt"></a>
        </p>
        <h4>
            <a name="lt">Line terminators</a>
        </h4>
        <p>A
            <i>line terminator</i>is a one- or two-character sequence that marks the end of a line of the input character sequence. The following are recognized as line terminators:</p>
        <ul>
            <li>A newline (line feed) character&#160;(
                <tt>'\n'</tt>),</li>
            <li>A carriage-return character followed immediately by a newline character&#160;(
                <tt>"\r\n"</tt>),</li>
            <li>A standalone carriage-return character&#160;(
                <tt>'\r'</tt>),</li>
            <li>A next-line character&#160;(
                <tt>'\u0085'</tt>),</li>
            <li>A line-separator character&#160;(
                <tt>'\u2028'</tt>), or</li>
            <li>A paragraph-separator character&#160;(
                <tt>'\u2029</tt>).</li>
        </ul>
        <p>
            <a name="lt">If</a>
            <code>UNIX_LINES</code>
            mode is activated, then the only line terminators recognized are newline characters.
        </p>
        <p>The regular expression
            <tt>.</tt>matches any character except a line terminator unless the
            <code>DOTALL</code>
            flag is specified.
        </p>
        <p>By default, the regular expressions
            <tt>^</tt>and
            <tt>$</tt>ignore line terminators and only match at the beginning and the end, respectively, of the entire input sequence. If
            <code>MULTILINE</code>
            mode is activated then
            <tt>^</tt>matches at the beginning of input and after any line terminator except at the end of input. When in
            <code>MULTILINE</code>
            mode
            <tt>$</tt>matches just before a line terminator or the end of the input sequence.
        </p>
        <h4>
            <a name="cg">Groups and capturing</a>
        </h4>
        <p>Capturing groups are numbered by counting their opening parentheses from left to right. In the expression
            <tt>((A)(B(C)))</tt>, for example, there are four such groups:</p>
        <blockquote>
            <table cellpadding="1" cellspacing="0" summary="Capturing group numberings">
                <tbody>
                    <tr>
                        <th>1&#160;&#160;&#160;&#160;</th>
                        <td>
                            <tt>((A)(B(C)))</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>2&#160;&#160;&#160;&#160;</th>
                        <td>
                            <tt>(A)</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>3&#160;&#160;&#160;&#160;</th>
                        <td>
                            <tt>(B(C))</tt>
                        </td>
                    </tr>
                    <tr>
                        <th>4&#160;&#160;&#160;&#160;</th>
                        <td>
                            <tt>(C)</tt>
                        </td>
                    </tr>
                </tbody>
            </table>
        </blockquote>
        <p>Group zero always stands for the entire expression.</p>
        <p>Capturing groups are so named because, during a match, each subsequence of the input sequence that matches such a group is saved. The captured subsequence may be used later in the expression, via a back reference, and may also be retrieved from
            the matcher once the match operation is complete.</p>
        <p>The captured input associated with a group is always the subsequence that the group most recently matched. If a group is evaluated a second time because of quantification then its previously-captured value, if any, will be retained if the second
            evaluation fails. Matching the string
            <tt>"aba"</tt>against the expression
            <tt>(a(b)?)+</tt>, for example, leaves group two set to
            <tt>"b"</tt>. All captured input is discarded at the beginning of each match.</p>
        <p>Groups beginning with
            <tt>(?</tt>are pure,
            <i>non-capturing</i>groups that do not capture text and do not count towards the group total.</p>
        <h4>Unicode support</h4>
        <p>
            <a name="cg">This class follows</a>
            <i>Unicode Technical Report #18: Unicode Regular Expression Guidelines</i>
            , implementing its second level of support though with a slightly different concrete syntax.</p>
        <p>Unicode escape sequences such as
            <tt>\u2014</tt>in Java source code are processed as described in
            ?3.3of the Java Language Specification. Such escape sequences are also implemented directly by the regular-expression parser so that Unicode escapes can be
            used in expressions that are read from files or from the keyboard. Thus the strings
            <tt>"\u2014"</tt>and
            <tt>"\\u2014"</tt>, while not equal, compile into the same pattern, which matches the character with hexadecimal value
            <tt>0x2014</tt>.
            <a name="ubc"></a></p>
        <p>
            <a name="ubc">Unicode blocks and categories are written with the
                <tt>\p</tt>and
                <tt>\P</tt>constructs as in Perl.
                <tt>\p{</tt>
                <i>prop</i>
                <tt>}</tt>matches if the input has the property
                <i>prop</i>, while \P{
                <i>prop</i>
                <tt>}</tt>does not match if the input has that property. Blocks are specified with the prefix
                <tt>In</tt>, as in
                <tt>InMongolian</tt>. Categories may be specified with the optional prefix
                <tt>Is</tt>: Both
                <tt>\p{L}</tt>and
                <tt>\p{IsL}</tt>denote the category of Unicode letters. Blocks and categories can be used both inside and outside of a character class.</a>
        </p>
        <p>
            <a name="ubc">The supported blocks and categories are those of</a>
            <i>The Unicode Standard, Version&#160;3.0</i>.
            The block names are those defined in Chapter&#160;14 and in the file
            Blocks-3.txt f the Unicode Character Database except that the spaces are removed;
            <tt>"Basic Latin"</tt>, for example, becomes
            <tt>"BasicLatin"</tt>. The category names are those defined in table 4-5 of the Standard (p.&#160;88), both normative and informative.</p></body>
</html>

